package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JasyptController {

    @Value("${spring.datasource.password}")
    private String dbPassword; // 数据库密码

    /**
     * 解密
     * 注意：在不知道盐值(即密钥)情况下解密得到明文
     */
    @RequestMapping(value = "/demo/jasypt/decypt")
    public String decypt(){
        System.out.println("spring.datasource.password = "+dbPassword);
        return "数据库密码=" + dbPassword;
    }
}
